package com.code516.dao;

import com.code516.entity.CommentEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CommentDao {

	@Insert(value = "insert into comment_info(commentId,stuId,commentInfo,commentTime,parentId,workId,isUsed) values(#{commentEntity.commentId},#{commentEntity.stuId},#{commentEntity.commentInfo},#{commentEntity.commentTime},#{commentEntity.parentId},#{commentEntity.workId},#{commentEntity.isUsed})")
	public void saveComment(@Param("commentEntity")CommentEntity commentEntity) throws Exception;

	@Select(value = "select * from comment_info")
	public List<CommentEntity> findAllComment() throws Exception;

	@Select(value = "select * from comment_info where workId=#{workId}")
	public List<CommentEntity> findAllCommentByWorkId(int workId) throws Exception;
	
	
}
